package service

import (
	"encoding/json"
	"tdy-backend/global"
)

type MessageService struct {
}

func (o *MessageService) Send(uniqueKey string, data map[string]interface{}) {
	//DataMap := map[string]string{"status": "success", "b": 2, "c": 3}
	jsonResult, _ := json.Marshal(data)
	hub := global.TYD_HUB
	if hub.Clients[uniqueKey] != nil {
		hub.Clients[uniqueKey].Send <- jsonResult
	}
}
